package samples.spring.step2.beans;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author Zi Lai Ye
 * @date 2017/4/11
 */
public class MyBeanPostProcesser implements BeanPostProcessor {
    public static final Logger LOGGER = LoggerFactory.getLogger(MyBeanPostProcesser.class);

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        LOGGER.info("============beanname:{} postprocesser:{}'s method:{} invoked.", beanName, this.getClass().getSimpleName(), "postProcessBeforeInitialization");
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        LOGGER.info("============beanname:{} postprocesser:{}'s method:{} invoked.", beanName, this.getClass().getSimpleName(), "postProcessAfterInitialization");
        return bean;
    }
}
